<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title></title>

  <link rel="stylesheet" href="../../../bootstrap/css/bootstrap.css">
  <link rel="stylesheet" href="../../../bootstrap/css/bootstrap-datepicker.min.css">
  <script src="../../../bootstrap/js/jquery-1.9.1.min.js"></script>
  <script src="../../../bootstrap/js/bootstrap.js"></script>
  <script src="../../../bootstrap/js/vue.min.js"></script>
  <script src="../../../bootstrap/js/axios.min.js"></script>

</head>
<body>

<div id="app">

</div>

</body>
</html>

<script>

  let files = null;

  new Vue({
    el:"#app",
    data:{
      removeImgFlag:0
    },
    mounted:function (){
      this.checkOpenId()
    },
    methods:{
      getAuthorize:function (){ // 中间页面，先去获取openid
        axios.get(
                "/staff/employee/authorize"
        ).then(response=>{
            // 验证下openid是否获取到
            window.location.href = response.data
            //this.checkOpenId()
        })
      },
      checkOpenId:function () {
        axios.get(
                "/staff/employee/getOpenId"
        ).then(response=>{
          if(response.data==false){
            this.getAuthorize()
          }else if(response.data){
            let flag =  [[${flag}]]
            if(flag==1){
              window.location.href="/staff/employee/toAdd"
            }
            if(flag==2){
              this.checkInfoBind()
            }
          }
        })
      },
      checkInfoBind:function (){ // 查看用户信息是否绑定了，如果绑定了，可以跳转列表页面，否则跳转绑定信息页面
        axios.get(
                "/staff/employee/getInfo"
        ).then(response=>{
          if(response.data==null){
            window.location.href="/staff/reimbursement/error"
          }else{
            window.location.href="/staff/reimbursement/list"
          }
        })
      }

    }
  });




</script>

